/**
 * Created by CodeTlan.
 * User: Ing. Miguel Salas
 * Date: 3/11/12
 * Time: 5:00 PM
 */
Ext.define('CT.view.trabajador.Grid', {
    extend: 'Ctc.view.EditorGrid',
    alias:"widget.gridtrabajador",
    store:'Trabajadores',
    requires: 'Ext.ux.grid.checkcolumn.CheckColumn',
    buildColumns: function(){
        Ext.define('combodelegadogrid',{
            extend:'CT.view.delegado.Combo',
            alias:'widget.combodelegadogrid',
            valueField:'delegado'
        });
        Ext.define('combosecretariogrid',{
            extend:'CT.view.secretario.Combo',
            alias:'widget.combosecretariogrid',
            valueField:'secretario'
        });
        return [
            { xtype: 'rownumberer'},
            { header: 'Ficha', dataIndex: 'ficha',width: 50 },
            { header: 'Nombre', dataIndex: 'nombre', vtype: 'textspace',flex: 2, editor: { allowBlank: false, vtype: 'textspace' }},
            { header: 'Apellidos', dataIndex: 'apellidos',vtype: 'textspace', flex: 2, editor: { allowBlank: false, vtype: 'textspace' }},
            { header: 'Delegado', dataIndex: 'delegado', flex: 2, editor: 'combodelegadogrid'},
            { header: 'Secretario', dataIndex:'secretario', flex: 2, editor: 'combosecretariogrid'},
            { dataIndex: 'activo', width: 40, align: 'center', xtype: 'checkcolumn', editor: { xtype: 'checkbox', cls: 'x-grid-checkheader-editor' }},
            { align: 'center', width: 40, renderer: this._renderEliminar, editor:{xtype:'hiddenfield'}}
        ];
    },
    buildTbar: function(){
        return [{
            xtype: 'button',
            itemId:'btnDepartamentos',
            action:'addDepartamento',
            text: 'Agregar Departamentos',
            iconCls: 'add',
            disabled: 'true'
        }];
    },
    _renderEliminar: function(value){
        return "<img src='img/icons/16/del.png' style='cursor:pointer'>";
    }
});